<?php 
namespace app\api\controller\v1;
use think\Request;

class File extends Base {
    
    // 上传文件
    public function uploadFile() {
        $baseUrl = config('config.baseUrl');
        $file = Request::instance()->file('file');

        $info = $file->move('upload');

        if ($info && $info->getPathname()) {
            return show(1, '上传成功', $baseUrl.'/'.$info->getPathname());
        }

        return show(0, '上传失败', [], 200);
    }
}